import axios from 'axios'
import NProgress from 'nprogress';
import 'nprogress/nprogress.css'
import {serverHost,port} from './config'
axios.defaults.timeout = 15000;
let r = axios.create({
    baseURL:`${serverHost}:${port}/`,
    withCredentials:'include',
});
r.interceptors.request.use((config)=>{
    NProgress.start();
     return config;
},(err)=>{
    return Promise.reject(err);
});
r.interceptors.response.use((response)=>{
    NProgress.done();
    return response;
},(error)=>{
    return Promise.reject(error);
});
export default r;